1. Field
The present invention generally relates to ray-traced based rendering two-dimension representations from three-dimensional scenes, and more particularly to hardware accelerating ray tracing for such rendering.
2. Description of Related Art
Rendering photo-realistic images with ray tracing is known in the computer graphics arts to have the ability to produce photo-realistic images, including realistic shadow and lighting effects, because ray tracing models the physical behavior of light interacting with elements of a scene. However, ray tracing is also known to be computationally intensive, and at present, even a state of the art graphics workstation requires a substantial amount of time to render a complicated, high resolution scene using ray tracing.
Ray tracing usually involves obtaining a scene description composed of geometric primitives, such as triangles, that describe surface of structures in the scene. For example, a scene may comprise a car on a street with buildings on either side of the street. The car in such a scene may be defined by a large number of triangles (e.g., 1 million triangles) that approximate a continuous surface. A camera position from which the scene is viewed is defined. An image plane of a selected resolution (e.g., 1024×768 for an SVGA display) is disposed at a selected position between the camera and the scene.
A principal objective of ray tracing is to determine a color and intensity for each pixel of the image plane, such that this image can thereafter be displayed on a monitor, for example. In the physical world, viewing such a scene from the camera's perspective would result in light rays reaching the camera that owe their existence to one or more light sources, including diffuse and directed light sources. In the physical world, these light sources project light energy into the scene, and this light energy is transmitted, diffracted, reflected, and/or absorbed according to the types of materials that the light contacts, and the order in which they are contacted, during its journey from light source to the camera. This process is what ray tracing attempts to duplicate.
Although the physical world operates by light energy being traced from a source to the camera, because only a small portion of the light generated by a source arrives at the camera, it has been recognized that rays, for most circumstances, should be traced from the camera back to determine intersections with light sources, instead.
A simplistic ray tracing algorithm involves casting rays from the camera through each pixel of the image into the scene. Each ray is then tested against each primitive composing the scene to identify a primitive which that ray intersects, then it is determined what effect that primitive has on the ray, for example reflecting and/or refracting it.
More complicated ray tracing can involve using different lighting techniques, and testing for conditions related to lighting sources, and other operations. For example, sampling lighting sources to determine occlusion of a ray origin can involve casting rays towards a known source of light. These rays are often generated during “shading” of a primitive (i.e., to determine a color) of a primitive intersected by a ray, and ultimately this color information will influence a color of one or more pixels in the 2-D rendered scene. The process of tracing a ray to identify an intersected primitive, the shading of the primitive, and consequent generation of additional rays can be an iterative loop (i.e., generated rays intersect further primitive, which must be shaded, during which further rays are generated). Ultimately, rays will leave the scene, or intersect a light source.
Most ray tracing systems and programs maintain state for all the rays generated during such iteration. Consequently, tracing a ray from its camera origin through all the child rays that may be generated, in response to various intersections, can require a great deal of storage. Therefore, ray tracing systems usually involve testing a relatively small number of camera rays at a given time, compared with a total number of rays that may be tested in total for that scene.
Hardware acceleration of ray tracing has been proposed and implemented, and often, such hardware acceleration involves instantiating groups of intersection testing and ray shading units that operate to trace different camera rays through a scene. This architecture works, because rays do not interfere with each other, such that rays relating to different camera rays can be traced in parallel. An amount of ray data that such hardware accelerators use at a given time, or within a given timeframe is not particularly large compared with an amount of bandwidth and storage generally available to such accelerators.
Other types of hardware implementations for ray tracing have been proposed. One such proposal is to volumetrically divide a scene into 3-D cubes, and assigning intersection testing for any primitive within that cube to a different processor. Rays traverse the 3-D cubes in order of each ray's movement through the scene. A ray enters a cube through an input queue, and so long as there is no intersection with a primitive for that ray in that cube, the ray is passed from that cube to the input queue of the next cube. Here also, an amount of ray data used by such a processor at a given time is not considered large compared with an amount of bandwidth conventionally available when connecting processing units or adapter cards, and the like.